﻿<%@ Page Language="C#" MasterPageFile="~/ControlPanel/CPanel.master" AutoEventWireup="True"
    Codebehind="UserRoles.aspx.cs" Inherits="ControlPanel_Member_UserRoles" Title="用户组"
    StylesheetTheme="MainStyle" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">    
    <div align="center">
        <br />
        <h3 style="text-align: center">
            用户：[<asp:Label ID="lbl_UserName" runat="server"></asp:Label>]的角色管理
        </h3>
        <br />
        <atlas:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <table>
                    <tr>
                        <td style="width: 100px">
                            已有角色</td>
                        <td style="width: 25px">
                        </td>
                        <td style="width: 100px">
                            未选角色</td>
                    </tr>
                    <tr>
                        <td style="width: 100px">
                            <asp:ListBox ID="lst_UserRole" runat="server" Height="250px" Width="150px" SelectionMode="Multiple">
                            </asp:ListBox></td>
                        <td style="width: 25px">
                            <asp:Button ID="btn_UnSelectAll" runat="server" Text=">>" Width="40" OnClick="btn_UnSelectAll_Click" />
                            <asp:Button ID="btn_UnSelect" runat="server" Text=">" Width="40" OnClick="btn_UnSelect_Click" />
                            <asp:Button ID="btn_Select" runat="server" Text="<" Width="40" OnClick="btn_Select_Click" />
                            <asp:Button ID="btn_SelectAll" runat="server" Text="<<" Width="40" OnClick="btn_SelectAll_Click" />
                        </td>
                        <td style="width: 100px">
                            <asp:ListBox ID="lst_RestRole" runat="server" Height="250px" Width="150px" SelectionMode="Multiple">
                            </asp:ListBox></td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            <input id="btn_ShowSuccess" type="button" runat="server" value="保存" />
                            <asp:Button ID="btn_Save" runat="server" Style="display: none" OnClick="btn_Save_Click" />
                            <input id="btn_Refresh" type="button" value="重置" onclick="location.href=location.href" /> &nbsp;&nbsp;
                            <asp:Button ID="btn_Return" runat="server" Text="返回" OnClick="btn_Return_Click" />
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
        </atlas:UpdatePanel>
        <asp:Panel ID="PanelSuccess" runat="server" CssClass="modalPopupBack" Width="192"
            Style="display: none" Height="84">
            <!--iframe shim-->
            <iframe style="position: absolute; top: 0px; left: 0px; display: block; background-color: Gray;
                filter: alpha(opacity=100); opacity: 0.7" frameborder="0" width="192" height="84">
            </iframe>
            <div id="PopupDiv" class="modalPopup" align="center">
                <br />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;确认更新用户角色？？&nbsp;&nbsp;&nbsp; &nbsp;
                <br />
                <asp:Button ID="OkButton" runat="server" Text="确定"></asp:Button>
                <br />
            </div>
        </asp:Panel>
        <br />
        <!--采用Atlas做模态提示对话框，颇费周折 温正宇:2006年9月2日3：00-->
        <atlasToolkit:ModalPopupExtender ID="ModalPopupExtenderOk" runat="server">
            <Animations TargetControlID="btn_ShowSuccess" PopupControlID="PanelSuccess"
                BackgroundCssClass="modalBackground" DropShadow="false" OkControlID="OkButton"
                OnOkScript="updateToDb()" />
        </atlasToolkit:ModalPopupExtender>
        

    </div>

    <script language="javascript" type="text/javascript">  
    //客户端的改变不能够影响到服务器，因为.net2.0新的安全机制引起的
    //所以这段脚本无效，没有使用，不过暂且保留
    function choose(src, dst,all) {
        var oSelect1 = document.getElementById(src);
        var oSelect2 = document.getElementById(dst);
        
        var opts = new Array();           
        var i;                    

            for(i = 0; i < oSelect1.options.length; i++)
            {            
                var item = oSelect1.options[i];  
                if (all == true)
                {
                       opts.push(item);                
                }
                else
                {   
                    if(item.selected) 
                    {
                        opts.push(item);                 
                    }
                }
            }       
            
            for(i = 0; i < opts.length; i++)
            {            
                var opt = document.createElement("<option>");
                opt.text = opts[i].text;
                opt.value = opts[i].value;
                
                if(navigator.appName == 'Microsoft Internet Explorer') {
                    oSelect2.add(opt);
                    //oSelect2.add(opt, null); // IE 不支持
                    //oSelect2.appendChild(opt); // IE 不支持,可以添加，但是不显示，^||^
                }
                else {
                    //oSelect2.add(opt);      // firefox 不支持
                    oSelect2.add(opt, null);                
                    //oSelect2.appendChild(opt); // firefox 支持
                }
                oSelect1.removeChild(opts[i]);                    
            }
    }   
    </script>

</asp:Content>
